#include <iostream>
#include <iomanip>
using namespace std;

class PhoneNumber{
	friend ostream &operator<<(ostream&, const PhoneNumber &);
	friend istream &operator>>(istream&, PhoneNumber &);
	private:
		char areaCode[4];
		char exchange[4];
		char line[5];
};

ostream &operator<<(ostream &output, const PhoneNumber &num)
{
	output << "(" << num.areaCode << ")"
			<< num.exchange << "-" << num.line;
	return output;
}
istream &operator>>(istream &input, PhoneNumber &num)
{
	input.ignore();
	input >> setw(4) >> num.areaCode;
	input.ignore();
	input >> setw(4) >> num.exchange;
	input.ignore();
	input >> setw(5) >> num.line;
	return input;
}
int main(void)
{
	PhoneNumber phone;

	cout << "Enter the phone number in the form of (123) 456-78910\n";
	cin >> phone;
	cout << "The phone number entered is:\n" ;
	cout << phone << "\n";
	return 0;
}
